package com.bwie.article.controller;

import com.bwie.article.service.ArticleService;
import com.bwie.common.domain.Article;
import com.bwie.common.result.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/article")
public class ArticleController {

    @Autowired
    private ArticleService articleService;

    @GetMapping("/findArticleList")
    public Result<List<Article>> findArticleList(){
        Result articleList = articleService.findArticleList();
        return articleList;
    }

    @PostMapping("/addArticle")
    public Result addArticle(@RequestBody Article article){
        articleService.addArticle(article);
        return Result.success();
    }

    @GetMapping("/findTypeList")
    public Result findTypeList(){
        Result typeList = articleService.findTypeList();
        return typeList;
    }

}
